<?php
include('include/db-connect.php');
$files = file('/home/wylde/media.dump');

foreach($files as $file)
{ 
	$array = explode(",,,,,", $file);
	$type = $array[0];
	$category = $array[1];
	$title = addslashes($array[2]);
	$filename = addslashes($array[3]);
	insert($type,$category,$title,$filename);	
}

function insert($type,$category,$title,$filename)
{
	$sql = "INSERT INTO mediadb.media ( type, category, title, filename ) VALUES ('$type', '$category', '$title', '$filename' )";
#	$sql = mysql_real_escape_string($sql);
#        $sql = addslashes($sql);
	echo $sql;
        mysql_query($sql) or die (mysql_error());
        $stats = "INSERT INTO mediadb.stats (viewCount, duration) VALUES ('0','01:33:70')";
        mysql_query($stats) or die (mysql_error());
	


}


?>
